A = [1 2 4 8; 2 2 3 4; 4 3 3 1; 3 2 1 4];
B = [9 8 9 8; 7 8 8 9; 9 9 9 6; 7 8 9 8];

A*B

C = funky(A,B, 4);
C